var fs = require("fs");
var c
 
function f(x) {
    console.log(x)
}
 
function writeFile() { 
    fs.writeFile('input.txt', '我是通过fs.writeFile 写入文件的内容', function (err) {
        if (!err) {
            console.log("文件写入完毕!")
            c = 1
            f(c)
        }
    });
}
 
c = 0

writeFile();